<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Links and Auxiliary Files</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Links and Auxiliary Files' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inblorb</a></li><li><a href="index.html#3">Chapter 3: Other Material</a></li><li><b>Links and Auxiliary Files</b></li></ul></div>
<p class="purpose">To manage links to auxiliary files, and placeholder variables.</p>

<ul class="toc"><li><a href="3-laaf.html#SP1">&#167;1. Auxiliary files</a></li><li><a href="3-laaf.html#SP2">&#167;2. Registration</a></li><li><a href="3-laaf.html#SP4">&#167;4. Linking</a></li><li><a href="3-laaf.html#SP6">&#167;6. Links</a></li><li><a href="3-laaf.html#SP7">&#167;7. Cover image</a></li><li><a href="3-laaf.html#SP8">&#167;8. Releasing</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Auxiliary files.</b>These are for items bundled up with the release but which are deliberately made
accessible for the eventual player: things such as maps or manuals. Inblorb
needs to know about these only when releasing a website; they are also recorded
in an iFiction record, but Inblorb doesn't create that, Inform 7 does.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">full_filename</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aux_leafname</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aux_subfolder</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">description</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format</span><span class="plain-syntax">; </span><span class="comment-syntax"> e.g., "jpg", "pdf"</span>
<span class="plain-syntax">    </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure auxiliary_file is accessed in 5/im, 10/ts, 10/fm, 2/bw and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Registration.</b>The format text is set to a lower-case version of the filename extension,
and the URL to the filename itself; except when there is no extension, so
that the auxiliary resource is a mini-website in a subfolder of the release
website. In that case the format is <span class="extract"><span class="extract-syntax">link</span></span> and the URL is to the index file
in the subfolder.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::create_auxiliary_file</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Links::create_auxiliary_file</span></span>:<br/>Blurb Parser - <a href="1-bp.html#SP7_2">&#167;7.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">fn</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">description</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">subfolder</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aux</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">description</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">description</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_subfolder</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">subfolder</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">ext</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="3-laaf.html#SP2" class="function-link"><span class="function-syntax">Links::get_extension_from_textual_filename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ext</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="3-laaf.html#SP3" class="function-link"><span class="function-syntax">Links::get_leafname_from_textual_filename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_first_char</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ext</span><span class="plain-syntax">) == </span><span class="character-syntax">'.'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_filename</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ext</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="../foundation/4-sm.html#SP25" class="function-link"><span class="function-syntax">Str::delete_first_character</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="../foundation/4-sm.html#SP14" class="function-link"><span class="function-syntax">Str::put</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><a href="../foundation/4-chr.html#SP1" class="function-link"><span class="function-syntax">Characters::tolower</span></a><span class="plain-syntax">(</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_filename</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"link"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_leafname</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">ext</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">)</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">PRINT</span><span class="plain-syntax">(</span><span class="string-syntax">"! Auxiliary file: &lt;%S&gt; = &lt;%S&gt;\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">, </span><span class="identifier-syntax">description</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::get_extension_from_textual_filename</span><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="reserved-syntax">filename</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP8" class="function-link"><span class="function-syntax">Str::len</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=0) &amp;&amp; ((</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="character-syntax">'.'</span><span class="plain-syntax">) || (</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="character-syntax">' '</span><span class="plain-syntax">))) </span><span class="identifier-syntax">i</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=0) &amp;&amp; (</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">) != </span><span class="character-syntax">'.'</span><span class="plain-syntax">) &amp;&amp; (</span><a href="../foundation/1-wp.html#SP3" class="function-link"><span class="function-syntax">Platform::is_folder_separator</span></a><span class="plain-syntax">(</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">)) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">i</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;0) || (</span><a href="../foundation/1-wp.html#SP3" class="function-link"><span class="function-syntax">Platform::is_folder_separator</span></a><span class="plain-syntax">(</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">)))) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="../foundation/4-sm.html#SP17" class="function-link"><span class="function-syntax">Str::copy_tail</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::get_leafname_from_textual_filename</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Links::get_leafname_from_textual_filename</span></span>:<br/><a href="3-laaf.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="reserved-syntax">filename</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP8" class="function-link"><span class="function-syntax">Str::len</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax">&gt;=0) &amp;&amp; (</span><a href="../foundation/1-wp.html#SP3" class="function-link"><span class="function-syntax">Platform::is_folder_separator</span></a><span class="plain-syntax">(</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">)) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">i</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">    </span><a href="../foundation/4-sm.html#SP17" class="function-link"><span class="function-syntax">Str::copy_tail</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Linking.</b>The list of links to auxiliary resources is written using <span class="extract"><span class="extract-syntax">&lt;li&gt;...&lt;/li&gt;</span></span>
list entry tags, for convenience of CSS styling.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::expand_AUXILIARY_variable</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Links::expand_AUXILIARY_variable</span></span>:<br/>Placeholders - <a href="3-plc.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aux</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">aux</span><span class="plain-syntax">, </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP22" class="function-link"><span class="function-syntax">Str::eq_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">description</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"--"</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;li&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="3-laaf.html#SP6" class="function-link"><span class="function-syntax">Links::download_link</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">description</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_leafname</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;/li&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="3-rls.html#SP10" class="function-link"><span class="function-syntax">Requests::add_links_to_requested_resources</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>On some of the pages produced by Inblorb the story file itself looks like
another auxiliary resource, but it's produced thus:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::expand_DOWNLOAD_variable</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">Links::expand_DOWNLOAD_variable</span></span>:<br/>Placeholders - <a href="3-plc.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eventual_Blorb_location</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="../foundation/3-fln.html#SP2" class="function-link"><span class="function-syntax">Filenames::in</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">release_folder</span><span class="plain-syntax">, </span><a href="3-plc.html#SP3" class="function-link"><span class="function-syntax">Placeholders::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"STORYFILE"</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="3-laaf.html#SP6" class="function-link"><span class="function-syntax">Links::download_link</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Story File"</span><span class="plain-syntax">, </span><span class="identifier-syntax">eventual_Blorb_location</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-plc.html#SP3" class="function-link"><span class="function-syntax">Placeholders::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"STORYFILE"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Blorb"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Links.</b>This routine, then, handles either kind of link.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::download_link</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">Links::download_link</span></span>:<br/><a href="3-laaf.html#SP4">&#167;4</a>, <a href="3-laaf.html#SP5">&#167;5</a><br/>Releaser - <a href="3-rls.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">relative_url</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">form</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">size_up</span><span class="plain-syntax"> = </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP22" class="function-link"><span class="function-syntax">Str::eq_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">form</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"link"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">size_up</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;a href=\"%S\"&gt;%S&lt;/a&gt; "</span><span class="plain-syntax">, </span><span class="identifier-syntax">relative_url</span><span class="plain-syntax">, </span><span class="identifier-syntax">desc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-wm.html#SP4" class="function-link"><span class="function-syntax">Websites::open_style</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="string-syntax">"filetype"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"(%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">form</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size_up</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">size</span><span class="plain-syntax"> = -1</span><span class="identifier-syntax">L</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP22" class="function-link"><span class="function-syntax">Str::eq_wide_string</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">desc</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"Story File"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">size</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">blorb_file_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">size</span><span class="plain-syntax"> = </span><a href="../foundation/6-bf.html#SP7" class="function-link"><span class="function-syntax">BinaryFiles::size</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> != -1</span><span class="identifier-syntax">L</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-laaf.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Write a description of the rough file size</span><span class="named-paragraph-number">6.1</span></a></span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">")"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-wm.html#SP4" class="function-link"><span class="function-syntax">Websites::close_style</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="string-syntax">"filetype"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b>We round down to the nearest KB, MB, GB, TB or byte, as appropriate. Although
this will describe a 1-byte auxiliary file as "1 bytes", the contingency seems
remote.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write a description of the rough file size</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"&amp;nbsp;bytes"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">) { </span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> = </span><span class="identifier-syntax">size</span><span class="plain-syntax"> % </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">size</span><span class="plain-syntax"> /= </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"KB"</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">) { </span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> = </span><span class="identifier-syntax">size</span><span class="plain-syntax"> % </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">size</span><span class="plain-syntax"> /= </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"MB"</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">) { </span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> = </span><span class="identifier-syntax">size</span><span class="plain-syntax"> % </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">size</span><span class="plain-syntax"> /= </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"GB"</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">) { </span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> = </span><span class="identifier-syntax">size</span><span class="plain-syntax"> % </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">size</span><span class="plain-syntax"> /= </span><span class="constant-syntax">1024</span><span class="identifier-syntax">L</span><span class="plain-syntax">; </span><span class="identifier-syntax">units</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"TB"</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">",&amp;nbsp;%d"</span><span class="plain-syntax">, (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">size</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">size</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">100</span><span class="identifier-syntax">L</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">remainder</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">103</span><span class="identifier-syntax">L</span><span class="plain-syntax">)) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">".%d"</span><span class="plain-syntax">, (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) (</span><span class="identifier-syntax">remainder</span><span class="plain-syntax">/103</span><span class="identifier-syntax">L</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">units</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-laaf.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Cover image.</b>Note that if the large cover image is a PNG, so is the small (thumbnail)
version, and vice versa &mdash; supplying "Cover.jpg" and "Small Cover.png"
will not work.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::expand_COVER_variable</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">Links::expand_COVER_variable</span></span>:<br/>Placeholders - <a href="3-plc.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cover_exists</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format</span><span class="plain-syntax"> = </span><span class="string-syntax">"png"</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cover_is_in_JPEG_format</span><span class="plain-syntax">) </span><span class="identifier-syntax">format</span><span class="plain-syntax"> = </span><span class="string-syntax">"jpg"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;a href=\"Cover.%s\"&gt;&lt;img src=\"Small Cover.%s\" border=\"1\" width=\"120px\"&gt;&lt;/a&gt;"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="identifier-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Releasing.</b>When we generate a website, we need to copy the auxiliary files into it
(though not mini-websites: the user will have to do that).
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Links::request_copy_of_auxiliaries</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">Links::request_copy_of_auxiliaries</span></span>:<br/>Releaser - <a href="3-rls.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aux</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">aux</span><span class="plain-syntax">, </span><span class="reserved-syntax">auxiliary_file</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::ne</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"link"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">verbose_mode</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">PRINT</span><span class="plain-syntax">(</span><span class="string-syntax">"! COPY &lt;%f&gt; as &lt;%S&gt;\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_leafname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">as_text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">as_text</span><span class="plain-syntax">, </span><span class="string-syntax">"%f"</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_filename</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="3-rls.html#SP4" class="function-link"><span class="function-syntax">Requests::request_copy</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">as_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_leafname</span><span class="plain-syntax">, </span><span class="identifier-syntax">aux</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">aux_subfolder</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">as_text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="3-sd.html">&#10094;</a></li><li class="progresschapter"><a href="M-ui.html">M</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-bw.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresssection"><a href="3-rls.html">rls</a></li><li class="progresssection"><a href="3-sd.html">sd</a></li><li class="progresscurrent">laaf</li><li class="progresssection"><a href="3-plc.html">plc</a></li><li class="progresssection"><a href="3-tmp.html">tmp</a></li><li class="progresssection"><a href="3-wm.html">wm</a></li><li class="progresssection"><a href="3-bs6.html">bs6</a></li><li class="progressnext"><a href="3-plc.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

